package exception;

import entity.ClientResponse;

    /**
     * 服务层自定义异常
     *
     * @author shishaolong
     * @datatime 2020/11/6 9:08
     */
    public class BusinessException extends RuntimeException implements IClientResponse{

        /**
         * 响应信息
         */
        private ClientResponse clientResponse;

        public BusinessException(String errMessage) {
            super(errMessage);
            this.clientResponse = ClientResponse.createError(errMessage);
        }

        public BusinessException(ClientResponse clientResponse) {
            super(clientResponse.getMessage());
            this.clientResponse = clientResponse;
        }


    @Override
    public ClientResponse getClientResponse() {
        return clientResponse;
    }
}
